import 'package:flutter/material.dart';
import 'car_model.dart';

//widget 小部件 一个widget就是一个类
//有状态的stateful 无状态 stateless
//container UIview div


class luoji_VIP_gaoji1MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new Home(),
    );
  }
}

//_私有  没有则共有
class Home extends StatelessWidget {
  Widget _itemForRow(BuildContext context, int index) {
    return Container(
//      color: Colors.red,
//      height: 42,
      margin: EdgeInsets.all(10),
        child: Column(children: <Widget>[//纵向布局 //row横向布局 //stack层级
          Image.network(datas[index].imageUrl),
          Text(datas[index].name),
        ],),
//        child: Image.network(datas[index].imageUrl),
    );
//    return Text(datas[index].name);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('FlutterDemo'),
      ),
      body: ListView.builder(
        itemCount: datas.length,
        itemBuilder: _itemForRow,
      ),
    );
  }
}
